/**
 * 
 */
package entity;

import java.math.BigDecimal;
import java.util.Date;

import utils.PaymentMethod;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * 
 * @author Hung
 * @since 06/03/2012
 * 
 */
@DatabaseTable
public class Transaction {
	@DatabaseField(generatedId=true)
	private int id;
	
	@DatabaseField
	private int year;
	
	@DatabaseField
	private int month;
	
	@DatabaseField
	private Date date;
	
	@DatabaseField
	private BigDecimal amount;
	
	@DatabaseField
	private String note;
	
	@DatabaseField(canBeNull=false, foreign=true)
	private Reference reference;
	
	@DatabaseField(canBeNull=false, foreign=true)
	private Category category;
	
	@DatabaseField(canBeNull=false, foreign=true, defaultValue="1")
	private Account account;
	
	@DatabaseField(canBeNull=false, defaultValue="1")
	private PaymentMethod paymentMethod;

	Transaction() {
		
	}
	
	public Transaction(int year, int month, Date date, BigDecimal amount, 
			String note, Reference ref, Category category, Account account, PaymentMethod paymentMethod) {
		this.year = year;
		this.month = month;
		this.date = date;
		this.amount = amount;
		this.note = note;
		this.reference = ref;
		this.category = category;
		this.account = account;
		this.paymentMethod = paymentMethod;
	}
	
	public int getId() {
		return id;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public int getMonth() {
		return month;
	}

	public void setMonth(int month) {
		this.month = month;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public BigDecimal getAmount() {
		return amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public Reference getReference() {
		return reference;
	}

	public void setReference(Reference reference) {
		this.reference = reference;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	public PaymentMethod getPaymentMethod() {
		return paymentMethod;
	}

	public void setPaymentMethod(PaymentMethod paymentMethod) {
		this.paymentMethod = paymentMethod;
	}
	
	
	
}
